//
//  JGRankingTableViewCell.m
//  MarianasTrench
//
//  Created by 付建国 on 16/3/21.
//  Copyright © 2016年 王爵. All rights reserved.
//

#import "JGRankingTableViewCell.h"

@interface JGRankingTableViewCell ()

@property (nonatomic, strong) UIImageView *imageV;
@property (nonatomic, strong) UILabel *titleL;
@property (nonatomic, strong) UILabel *nameL;
@property (nonatomic, strong) UILabel *timeL;
@property (nonatomic, strong) UILabel *kindL;


@end

@implementation JGRankingTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubView];
    }
    return self;
}
- (void)createSubView{
    self.imageV = [[UIImageView alloc] init];
    [self.contentView addSubview:_imageV];
    
    self.timeL = [[UILabel alloc] init];
    [self.contentView addSubview:_timeL];
    
    self.titleL = [[UILabel alloc] init];
    [self.contentView addSubview:_titleL];
    
    self.nameL = [[UILabel alloc] init];
    [self.contentView addSubview:_nameL];
    
    self.kindL = [[UILabel alloc] init];
    [self.contentView addSubview:_kindL];
    
}

- (void)setModel:(ListModel *)model{
    _model = model;
    [self fuzhi];
}
- (void)fuzhi{
//    [self.imageV sd_setImageWithURL:[NSURL URLWithString:_model.middleLogo]];
    dispatch_async(dispatch_get_main_queue(), ^{
        
        [self.imageV HANDLEIMAGE(_model.middleLogo)];
    });
    
    NSString *titleStr = [NSString stringWithFormat:@"%@ 🎤", _model.nickname];
    self.titleL.text = titleStr;
    self.titleL.numberOfLines = 10;
    self.titleL.font = [UIFont systemFontOfSize:15];
    
    NSString *nameStr = [NSString stringWithFormat:@"%@", _model.personDescribe];
    self.nameL.text = nameStr;
    self.nameL.textColor = [UIColor grayColor];
    self.nameL.font = [UIFont systemFontOfSize:14];
    
    NSString *str = [NSString stringWithFormat:@"⭐️%@", _model.followersCounts];
    self.timeL.text = str;
    self.timeL.textColor = [UIColor grayColor];
    self.timeL.font = [UIFont systemFontOfSize:12];
    
//    NSString *kindStr = [NSString stringWithFormat:@"%ld", self.kind];
//    self.kindL.text = kindStr;
}
// 布局
- (void)layoutSubviews{
    [super layoutSubviews];
    self.imageV.frame = CGRectMake(10, 5, self.contentView.frame.size.height -10, self.contentView.frame.size.height - 10);
    
    self.titleL.frame = CGRectMake(self.contentView.frame.size.height + 5, 5, self.contentView.frame.size.width - self.contentView.frame.size.height - 10, 40);
    
    self.nameL.frame = CGRectMake(self.contentView.frame.size.height + 5, 50, self.contentView.frame.size.width - self.contentView.frame.size.height - 10, 20);
    
    self.timeL.frame = CGRectMake(self.contentView.frame.size.height + 5, 70, self.contentView.frame.size.width - self.contentView.frame.size.height - 10, 15);
    
    self.kindL.frame = CGRectMake(SCREEN_WIDTH - 40, SCREEN_HETGHT / 2 - 20, 40, 40);
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
